//
//  HTTradeViewController.m
//  HaiYue
//
//  Created by skyline on 2017/12/14.
//  Copyright © 2017年 skyline. All rights reserved.
//

#import "HYTradeViewController.h"
#import "HYBuyView.h"
#import "HYTradeView.h"
@interface HYTradeViewController ()<HYBuyViewDelegate>
@property (nonatomic, strong) HYBuyView *buyView;
@property (nonatomic, strong) HYTradeView *tradeView;
@end

@implementation HYTradeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.segNaviBar.items = @[@"买号",@"卖号",@"我的交易"];
    self.buyView.hidden = NO;
    self.tradeView.hidden = NO;
    // Do any additional setup after loading the view.
}

- (HYBuyView *)buyView
{
    if (!_buyView)
    {
        _buyView = [[HYBuyView alloc] init];
        _buyView.delegate = self;
        [self.scrollView addSubview:_buyView];
        [_buyView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.scrollView);
            make.left.equalTo(self.scrollView);
            make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT - NAVIBAR_HEIGHT - STATUS_HEIGHT - TABBAR_HEIGHT));
        }];
    }
    return  _buyView;
}

- (HYTradeView *)tradeView
{
    if (!_tradeView)
    {
        _tradeView = [[HYTradeView alloc] init];
        [self.scrollView addSubview:_tradeView];
        [_tradeView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.scrollView);
            make.left.equalTo(self.scrollView).with.offset(SCREEN_WIDTH * 2.0);
            make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT - NAVIBAR_HEIGHT - STATUS_HEIGHT - TABBAR_HEIGHT));
        }];
    }
    return _tradeView;
}
#pragma mark - HYBuyViewDelegate
- (void)methodForHYBuyViewDelegateWithTag:(NSInteger)tag
{
    if (tag == 202)
    {
        [self.navigationController pushViewController:[NSClassFromString(@"HYSearchGameViewController") new] animated:NO];
    }
    else if (tag == 203)
    {
        [self.navigationController pushViewController:[NSClassFromString(@"HYDealViewController") new] animated:NO];
    }
}

- (void)methodForHYBuyViewDelegateWithIndexPath:(NSIndexPath *)indexpath
{
    [self.navigationController pushViewController:[NSClassFromString(@"HYRoleDetailViewController") new] animated:NO];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
